//
//  LGSliderDrawerConfigure.m
//  LGSliderDrawer
//
//  Created by apple on 2021/3/24.
//

#import "LGSliderDrawerConfigure.h"


@implementation LGSliderDrawerConfigure
/**
 默认配置

 @return 配置对象本身
 */
+ (instancetype)defaultConfiguration {

    return [LGSliderDrawerConfigure configurationWithDistance:kScreenWidth * 0.75 maskAlpha:0.3 direction:LGSliderDrawerTransitionDirectionRight gestureType:LGSliderDrawerGestureTypePan];
}

+ (instancetype)configurationWithDistance:(float)distance
                                maskAlpha:(float)alpha
                                direction:(LGSliderDrawerTransitionDirection)direction
                              gestureType:(LGSliderDrawerGestureType)gestureType {
    return [[self alloc] initWithDistance:distance maskAlpha:alpha direction:direction gestureType:gestureType];
}

- (instancetype)initWithDistance:(float)distance
                       maskAlpha:(float)alpha
                       direction:(LGSliderDrawerTransitionDirection)direction
                     gestureType:(LGSliderDrawerGestureType)gestureType{
    if (self = [super init]) {
        _distance = distance;
        _maskAlpha = alpha;
        _direction = direction;
        _showAnimDuration = 0.25;
        _HiddenAnimDuration = 0.25;
        _gestureType = gestureType;
    }
    return self;
}

- (float)distance {
    if (_distance <= 0)
        return kScreenWidth * 0.75;
    return _distance;
}

- (float)maskAlpha {
    if (_maskAlpha <= 0)
        return 0;
    return _maskAlpha;
}

- (NSTimeInterval)showAnimDuration {
    if (_showAnimDuration <= 0)
        return 0.25;
    
    return _showAnimDuration;
}

- (NSTimeInterval)HiddenAnimDuration {
    if (_HiddenAnimDuration <= 0)
        return 0.25;
    
    return _HiddenAnimDuration;
}

- (void)dealloc {
    NSLog(@"%s",__func__);
}

@end
